#ifndef USERWINDOW_H
#define USERWINDOW_H

#include <QMainWindow>
#include <addinfo.h>
#include <addinfosup.h>
#include "database.h"
#include "ui_userwindow.h"
#include <QAction>
#include <QtDebug>
#include <QTableWidget>
#include <QTableWidgetItem>
#include <modify.h>

namespace Ui {
class UserWindow;
}

enum Tables {SpOwner, SpStaff, SpIO, OwnMem, OwnBuy,
             StafMem, StafOwn, StafIO, VolAr, VolUna};

struct TableIndex {
  Tables index;
  int row;
  int column;
};

class UserWindow : public QMainWindow
{
  Q_OBJECT

public:
  explicit UserWindow(QWidget *parent = nullptr);
  ~UserWindow();

  void Log(const info& id);
  int userIndex_;
  Owner *own;
  Supervisor *Sup;
  Staff *staf;
  Volunteer *Vol;
  Individual Userinfo;
  void UpdateTable(QList<QStringList> *Family, QTableWidget *table,
                   int start, int end);
  QString SpAccount;
  QString SpPassword;
  QString SpId;
  QString VolAccount;
  QString VolPassword;
signals:
  void Logout();

private:
  Ui::UserWindow *ui;
  AddInfo *addNewInfo;
  addInfoSup *addNewInfoSup;
  void SetManageTable();
  void SetOwnerTable();
  void SetSupvTable();
  void SetStaffTable();
  void SetVoluntTable();
  TableIndex tableIndex_;


};

#endif // USERWINDOW_H
